<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <script src="/libs/react.development.js"></script>
    <script src="/libs/react-dom.development.js"></script>
    <script src="/libs/babel.min.js"></script>
    <title>Document</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">
      class Demo extends React.Component {
        render() {
          return (
            <div>
              <input ref="input1" type="text" placeholder="点击按钮提示" />
              <button onClick={this.showmsg}>按钮</button>
              <input
                onBlur={this.showmsg2}
                ref="input2"
                type="text"
                placeholder="失去焦点提示数据"
              />
            </div>
          );
        }
        showmsg = () => {
          alert(this.refs.input1.value);
          // alert();
        };
        showmsg2 = () => {
          alert(this.refs.input2.value);
        };
      }
      ReactDOM.render(<Demo />, document.getElementById("root"));
    </script>
  </body>
</html>
